<template>
	<view class="content">
		<view class="header">
			<image src="../../../static/images/login/bg_login.png"></image>
		</view>
		
		<view class="list">
			<view class="list-call">
				<view>登录名: </view>
				<input class="biaoti" v-model="loginName" type="text"  placeholder="登录名" />
			</view>
			<view class="list-call">
				<view>学号: </view>
				<input class="biaoti" v-model="no" type="number" maxlength="11" placeholder="学号" />
			</view>
			
			<view class="list-call">
				<view>登录密码: </view>
				<input class="biaoti" v-model="password" type="text" maxlength="32" placeholder="登录密码" :password="!showPassword" />
			</view>
			<view class="list-call">
				<view>姓名: </view>
				<input class="biaoti" v-model="name" type="text" maxlength="11" placeholder="姓名" />
			</view>
			<view class="list-call">
				<view>手机号: </view>
				<input class="biaoti" v-model="phone" type="number" maxlength="11" placeholder="手机号" />
			</view>
			<view class="list-call">
				<view>性别: </view>
				<input class="biaoti" v-model="sex" type="text" placeholder="男/女" />
			</view>
			<view class="list-call">
				<view>用户类型: </view>
				<input class="biaoti" v-model="userType" type="text" placeholder="学生为0,教师为1" />
			</view>
			<view class="list-call">
				<view>所在学院: </view>
				<input class="biaoti" v-model="college" type="text"  placeholder="所在学院" />
			</view>
			<view class="list-call">
				<view>邮箱: </view>
				<input class="biaoti" v-model="email" type="text"  placeholder="邮箱" />
			</view>
		</view>
		
		<view class="dlbutton" hover-class="dlbutton-hover" @tap="bindLogin">
			<text>注册</text>
		</view>
		
		<!-- <view class="xieyi">
			<image @tap="xieyitong" :src="xieyi==true?'/static/shilu-login/ty1.png':'/static/shilu-login/ty0.png'"></image>
			<text @tap="xieyitong"> 同意</text>
			<navigator url="blog?id=1" open-type="navigate">《软件用户协议》</navigator>
		</view> -->
	</view>
</template>

<script>
	import { reg } from '@/api/user/index'
	var tha,js;
	export default {
		// onLoad(){
		// 	tha = this;
		// 	
		// },
		// onUnload(){
		// 	clearInterval(js)
		// 	this.second = 0;
		// },
		data() {
			return {
				loginName:'',
				no:'',
				phone:'',
				password:'',
				name:'',
				sex:'', 
				college:'',
				userType:'',
				email:'',
				showPassword:false,
				second:0
			};
		},
		
		methods: {
		    bindLogin() {
				
				
		        if (this.password.length < 2) {
		            uni.showToast({
		                icon: 'none',
		                title: '密码不正确'
		            });
		            return;
		        }
				console.log("111",this.no)
				let u = {
					loginName: this.loginName,
					no: this.no,
					phone:this.phone,
					name: this.name,
					sex: this.sex,
					college:this.college,
					userType:this.userType,
					email:this.email,
					password:this.password
				};
				console.log("222",u)
				reg(u).then(res => {
			    console.log("11111111",res);
			    this.tui.toast("注册成功", 2000, true);
			    this.formReset(e);
				})
				uni.reLaunch({
					url: '/pages/login/login'
				})
		    }
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		justify-content:center;
	}
	.header {
		width:161upx;
		height:161upx;
		background:rgba(63,205,235,1);
		box-shadow:0upx 12upx 13upx 0upx rgba(63,205,235,0.47);
		border-radius:50%;
		margin-top: 30upx;
		margin-left: auto;
		margin-right: auto;
	}
	.header image{
		width:161upx;
		height:161upx;
		border-radius:50%;
	}
	
	.list {
		display: flex;
		flex-direction: column;
		padding-top: 50upx;
		padding-left: 70upx;
		padding-right: 70upx;
	}
	.list-call{
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		height: 100upx;
		color: #333333;
		border-bottom: 1upx solid rgba(230,230,230,1);
	}
	.list-call .img{
		width: 40upx;
		height: 40upx;
	}
	.list-call .biaoti{
		flex: 1;
		text-align: left;
		font-size: 32upx;
		line-height: 100upx;
		margin-left: 16upx;
	}
	.yzm {
		color: #FF7D13;
		font-size: 24upx;
		line-height: 64upx;
		padding-left: 10upx;
		padding-right: 10upx;
		width:auto;
		height:64upx;
		border:1upx solid #FFA800;
		border-radius: 50upx;
	}
	.yzms {
		color: #999999 !important;
		border:1upx solid #999999;
	}
	.dlbutton {
		color: #FFFFFF;
		font-size: 34upx;
		width:470upx;
		height:100upx;
		background:linear-gradient(-90deg,rgba(63,205,235,1),rgba(188,226,158,1));
		box-shadow:0upx 0upx 13upx 0upx rgba(164,217,228,0.2);
		border-radius:50upx;
		line-height: 100upx;
		text-align: center;
		margin-left: auto;
		margin-right: auto;
		margin-top: 100upx;
	}
	.dlbutton-hover {
		background:linear-gradient(-90deg,rgba(63,205,235,0.9),rgba(188,226,158,0.9));
	}
	.xieyi{
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		font-size: 30upx;
		margin-top: 80upx;
		color: #FFA800;
		text-align: center;
		height: 40upx;
		line-height: 40upx;
	}
	.xieyi image{
		width: 40upx;
		height: 40upx;
	}
</style>
